
#include <iostream>
#include <gmpxx.h>

#include "src/server/HttpServer.h"
#include "src/utils/Configuration.h"
#include "src/model/pool.h"
#include "src/utils/AwsS3Client.h"
#include "src/utils/DcmToolkit.h"
#include "src/utils/DicomImage.h"
#include "src/constant/JsonToStruct.h"
#include "src/constant/StringUtils.h"
#include "src/utils/DateUtils.h"
#include "src/processor/FileInstanceProcessor.h"
#include "src/processor/ResourcesProcessor.h"
#include "src/utils/ArchiveEnumUtils.h"
#include "src/utils/SearchId.h"
#include "src/utils/OpenSSLUtils.h"
#include <ctime>


void server_init() {
    Configuration &config = getGlobalConfiguration();
    if (!config.loadConfig("../config.yaml")) {
        throw std::runtime_error("load Configuration fail ");
    }

    ConnectionPool *pool = ConnectionPool::getInstance();
    if (pool == nullptr) {
        throw std::runtime_error("init mysql pool fail ");
    }

    Aws::SDKOptions options;
    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
    Aws::InitAPI(options);

    HttpServer server;
    std::cout << "CivetServer, listen on:" << server.getPort() << std::endl;

    server.run();
    Aws::ShutdownAPI(options);
}


int main() {
    server_init();
    return 0;
}

